﻿using BCCommon;
using BCDto.TMS.RedPacket.RedPacketReceive;
using BCService.TMS.RedPacket.RedPacketReceive;
using Microsoft.AspNetCore.Mvc;

namespace BCTMSRESTful.Controllers.Management.TMS.RedPacket
{
    /// <summary>
    /// 红包领取记录
    /// </summary>
    [Route("api/v1/sim/[controller]")]
    [ApiExplorerSettings(GroupName = "TMSAdmin")]
    public class RedPacketReceiveController : ManagementBaseController
    {
        private readonly IRedPacketReceiveService redPacketReceiveService;
        public RedPacketReceiveController(
            IRedPacketReceiveService redPacketReceiveService)
        {
            this.redPacketReceiveService = redPacketReceiveService;
        }

        /// <summary>
        /// 获取红包领取记录分页
        /// </summary>
        /// <param name="redPacketId">红包id</param>
        /// <param name="userId">用户</param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(PageableList<RedPacketReceiveDto>), 200)]
        public IActionResult ReceiveQuery([FromQuery(Name = "red_packet_id")] long? redPacketId,
            [FromQuery(Name = "user_id")] long? userId,
            [FromQuery(Name = "page_index")] int pageIndex = 1,
            [FromQuery(Name = "page_size")] int pageSize = 10)
        {
            var result = this.redPacketReceiveService.Query(this.Admin, redPacketId, userId, pageIndex, pageSize);
            return this.Ok(result);
        }
    }
}
